#!/usr/bin/python
import os
import stat
import tarfile

source="/home/openSUSE_Translation/verbum"
target="/home/gabriel/translate"
yastpath=target+"/yast/es"
lcnpath=target+"/lcn/es"

message="commit "
username="dahool"

names = os.listdir(source)
os.system(target+"/cu");

for name in names:
        try:
                st = os.lstat(os.path.join(source,name))
        except os.error:
                continue
        if stat.S_ISREG(st.st_mode):
                if  name.startswith("verbum"):
                        print "Commit => "+name
			tar = tarfile.open(os.path.join(source,name))
			tar.extractall("/home/gabriel/translate")
			tar.close()
			os.remove(os.path.join(source,name))
			os.chdir(yastpath)
			os.system("svn ci --username "+username+" -m '"+message+name+"'")
			os.chdir(lcnpath)
			os.system("svn ci --username "+username+" -m '"+message+name+"'")
